---
apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    component: "pushgateway"
    app: prometheus
  name: prometheus-pushgateway
  namespace: {{ .Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  labels:
    component: "pushgateway"
    app: prometheus
  name: prometheus-pushgateway
rules:
  []
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  labels:
    component: "pushgateway"
    app: prometheus
  name: prometheus-pushgateway
subjects:
  - kind: ServiceAccount
    name: prometheus-pushgateway
    namespace: {{ .Namespace }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: prometheus-pushgateway
---
apiVersion: v1
kind: Service
metadata:
  annotations:
    prometheus.io/probe: pushgateway
  labels:
    component: "pushgateway"
    app: prometheus
  name: prometheus-pushgateway
  namespace: {{ .Namespace }}
spec:
  ports:
    - name: http
      port: 9091
      protocol: TCP
      targetPort: 9091
  selector:
    component: "pushgateway"
    app: prometheus
  type: "ClusterIP"
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    component: "pushgateway"
    app: prometheus
  name: prometheus-pushgateway
  namespace: {{ .Namespace }}
spec:
  selector:
    matchLabels:
      component: "pushgateway"
      app: prometheus
  replicas: 1
  template:
    metadata:
      labels:
        component: "pushgateway"
        app: prometheus
    spec:
      serviceAccountName: prometheus-pushgateway
      containers:
        - name: prometheus-pushgateway
          image: "prom/pushgateway:v1.4.2"
          imagePullPolicy: "IfNotPresent"
          args:
          ports:
            - containerPort: 9091
          resources:
            {}
      securityContext:
        runAsUser: 65534
